package org.oop8.ioliu;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Scanner;
import java.util.Set;

public class zuoye {

	public static void main(String[] args) {
		String str = "abcdegfdaeds";
		char[] attr = str.toCharArray();
		Set<Character> set1 = new HashSet<Character>();//用来存放所有的字符
		Set<Character> set2 = new HashSet<Character>();//用来存放重复字符
		Set<Character> set3 = new HashSet<Character>();//用来存放不重复的字符
		for(char a : attr){
			boolean b = set1.add(a);//判断是否插入成功，set的特性是唯一、无序
			if(!b){
				set2.add(a);
			}
		}
		System.out.println(set1);
		System.out.println(set2);
		
		set3.addAll(set1);//往集合set3中添加全部集合set1
		set3.removeAll(set2);//把集合set3中包含集合set2的全部去掉
		System.out.println(set3);//现在的set3就是去掉重复的全部
	}

}
